package com.parfinex.java.phase1.module2.task09;

public class Rect extends Shape {
    private int width;
    private int lenth;

    public Rect() {
    }

    public Rect(int x, int y,int width,int lenth) {
        super(x, y);
        setLenth(lenth);
        setWidth(width);
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        if(width>0) {
            this.width = width;
        }else {
            System.out.println("长度不合理哦！");
        }
    }

    public int getLenth() {
        return lenth;
    }

    public void setLenth(int lenth) {
        if(lenth>0) {
            this.lenth = lenth;
        }else{
            System.out.println("宽度不合理哦！");
        }
    }

    @Override
    public void show() {
        super.show();
        System.out.println("width="+getWidth()+"lenth="+getLenth());
    }
}
